package com.mpcm.web.client.admin;

import com.gwtplatform.mvp.client.Presenter;
import com.gwtplatform.mvp.client.View;
import com.gwtplatform.mvp.client.annotations.ContentSlot;
import com.gwtplatform.mvp.client.annotations.ProxyCodeSplit;
import com.gwtplatform.mvp.client.proxy.Proxy;
import com.gwtplatform.mvp.client.proxy.RevealContentHandler;
import com.google.inject.Inject;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.event.shared.GwtEvent.Type;
import com.gwtplatform.mvp.client.proxy.RevealRootLayoutContentEvent;
import com.mpcm.web.client.admin.left.AdminLeftPresenter;

public class AdminLayoutPresenter extends
		Presenter<AdminLayoutPresenter.MyView, AdminLayoutPresenter.MyProxy> {

	public interface MyView extends View {
	}

	@ProxyCodeSplit
	public interface MyProxy extends Proxy<AdminLayoutPresenter> {
	}
	
	@ContentSlot
    public static final Type<RevealContentHandler<?>> TYPE_RevealContentLeft = new Type<RevealContentHandler<?>>();
	@ContentSlot
    public static final Type<RevealContentHandler<?>> TYPE_RevealContentRight = new Type<RevealContentHandler<?>>();

	private final AdminPresenter adminPresenter;
	private final AdminLeftPresenter adminLeftPresenter;
	
	@Inject
	public AdminLayoutPresenter(final EventBus eventBus, final MyView view,
			final MyProxy proxy, 
			final AdminPresenter adminPresenter, final AdminLeftPresenter adminLeftPresenter) {
		super(eventBus, view, proxy);
		
		this.adminPresenter = adminPresenter;
		this.adminLeftPresenter = adminLeftPresenter;
	}

	@Override
	protected void revealInParent() {
		RevealRootLayoutContentEvent.fire(this, this);
	}

	@Override
	protected void onBind() {
		super.onBind();
	}

	@Override
	protected void onHide() {
		super.onHide();
	}

	@Override
	protected void onReset() {
		super.onReset();
	}

	@Override
	protected void onReveal() {
		super.onReveal();
		
		setInSlot(TYPE_RevealContentLeft, adminLeftPresenter);
		setInSlot(TYPE_RevealContentRight, adminPresenter);
	}

	@Override
	protected void onUnbind() {
		super.onUnbind();
	}
}
